#ifndef FIXEDPOOL_LIBRARY_H
#define FIXEDPOOL_LIBRARY_H

#include <stdint.h>
#include <stdatomic.h>

#if defined(_WIN32) || defined(__CYGWIN__)
    #ifdef MYLIB_EXPORTS
        #define FIXEDPOOL_API __declspec(dllexport)
    #else
        #define FIXEDPOOL_API __declspec(dllimport)
    #endif
#else
    #if __GNUC__ >= 4 || defined(__clang__)
        #define FIXEDPOOL_API __attribute__ ((visibility ("default")))
    #else
        #define FIXEDPOOL_API
    #endif
#endif

typedef uint64_t Position;
typedef void* PItemData;

typedef struct {
    uint32_t size;          // 元素个数
    uint32_t item_size;     // 元素大小
    void *buffer;           // 元素数据
} FixedPool;

typedef struct {
    FixedPool *pool;         //
    atomic_ullong pool_unused_size;        // 未使用个数
    PItemData unused_item_list[];    // 未使用地址列表
} FixedPoolInterface ;  // Added missing semicolon here

// Corrected function declarations (should be outside struct)
FIXEDPOOL_API FixedPoolInterface* create_fixed_pool(uint32_t pool_size, uint32_t item_size);
FIXEDPOOL_API void release_fixed_pool(FixedPoolInterface *interface);
FIXEDPOOL_API PItemData get_item_in_pool(FixedPoolInterface *interface);
FIXEDPOOL_API void put_item_in_pool(FixedPoolInterface *interface, PItemData item);

#endif // FIXEDPOOL_LIBRARY_H